/**
* All Rights Reserved , Copyright (C) 2021 , 青岛鼎信通讯股份有限公司
*
* SdMilePostTemplateServiceAuto
* 里程碑模板
*
* 修改纪录
* 2021-10-18 版本：1.0 xinfushuo 创建。
* @version 版本：1.0
* @author 作者：xinfushuo
* 创建日期：2021-10-18
*/

package com.topscomm.gpm.service.impl.auto;

import javax.annotation.Resource;
import com.topscomm.basic.IBasicDao;
import com.topscomm.pub.util.ConvertUtil;
import com.topscomm.tap.common.DatacodeCache;
import java.util.Map;
import com.topscomm.gpm.*;
import com.topscomm.gpm.pojo.GpmMilePostTemplateEntity;
import com.topscomm.gpm.dao.IGpmMilePostTemplateDao;


public class GpmMilePostTemplateServiceAuto extends GpmService<GpmMilePostTemplateEntity, IGpmMilePostTemplateDao> {

	/**
	 * @author: xinfushuo
	 * @date: 2021-10-18
	 * @param mapRow
	 * @description:设置字段显示值
	 * @modify:
	 */
	@Override
	public void setDispFields(Map<String, Object> mapRow, DatacodeCache datacodeCache) {
		String temp;
		if (mapRow.get("type") != null) {
			temp = mapRow.get("type").toString();
			mapRow.put("disptype", datacodeCache.getValueDynamic("GpmMilePostTemplateType", temp, "code", "name"));
		}
		if (mapRow.get("enabled") != null) {
			temp = mapRow.get("enabled").toString();
			mapRow.put("dispenabled", datacodeCache.getValueDynamic("CboYesNo", temp, "code", "name"));
		}
		if (mapRow.get("projectlevel") != null) {
			String shu = ConvertUtil.convertToString(mapRow.get("projectlevel"));
			StringBuffer strings = new StringBuffer();
			for(String item:shu.split(",")){
				String valueDynamic = datacodeCache
					.getValueDynamic("GpmProjectLevel", item, "code", "name");
				strings.append(valueDynamic+',');
			}
			mapRow.put("dispprojectlevel",strings.substring(0,strings.lastIndexOf(",")));
			mapRow.put("projectlevel",shu.split(","));
		}
		if (mapRow.get("projecttype") != null) {
			temp = mapRow.get("projecttype").toString();
			mapRow.put("dispprojecttype", datacodeCache.getValueDynamic("GpmProjectType", temp, "code", "name"));
		}
	}

	@Override
	@Resource(name = "sdMilePostTemplateDao")
	public void setDao(IBasicDao<GpmMilePostTemplateEntity> dao) {
		super.setDao(dao);
	}
}
